package fibonacci;

public class Way1 {
	
	public static void main(String[] args) {
		final int num = 20;
		Way1 way1 = new Way1();
		//结果为：6765，一共执行了21891次
		System.out.println("结果为："+way1.fab(num)+"，一共执行了"+way1.count+"次");
	}
	
	private int count = 0;
	
	public int fab(int num) {
		count++;
		if(num<=0) {
			return 0;
		}
		if(num==1) {
			return 1;
		}
		return fab(num-1)+fab(num-2);
	}

}
